package com.ruoyi.tzai.domain;

import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
 * 任务队列对象 tzai_task_queue
 * 
 * @author tzai
 * @date 2025-11-12
 */
public class TaskQueue extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 任务ID */
    private Long taskId;

    /** 关联资讯文章ID */
    @Excel(name = "关联资讯ID")
    private Long articleId;

    /** 任务类型 */
    @Excel(name = "任务类型", readConverterExp = "article_process=资讯处理,audio_regenerate=音频重新生成")
    private String taskType;

    /** 优先级 */
    @Excel(name = "优先级")
    private Integer priority;

    /** 状态 */
    @Excel(name = "状态", readConverterExp = "pending=待处理,running=运行中,paused=已暂停,completed=已完成,failed=失败,cancelled=已取消")
    private String status;

    /** 当前步骤 */
    @Excel(name = "当前步骤")
    private String currentStep;

    /** 当前步骤进度 */
    @Excel(name = "当前步骤进度")
    private Integer currentStepProgress;

    /** 总体进度 */
    @Excel(name = "总体进度")
    private Integer totalProgress;

    /** 重试次数 */
    private Integer retryCount;

    /** 最大重试次数 */
    private Integer maxRetry;

    /** 错误信息 */
    private String errorMessage;

    /** 处理线程ID */
    private String workerThread;

    /** 开始时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date startedAt;

    /** 完成时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date completedAt;

    /** 预估剩余时间(秒) */
    private Integer estimatedTime;

    /** 任务配置JSON */
    private String config;

    /** 是否已清理临时数据 */
    private Boolean isCleaned;

    /** 清理时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date cleanedAt;

    public void setTaskId(Long taskId) 
    {
        this.taskId = taskId;
    }

    public Long getTaskId() 
    {
        return taskId;
    }

    public void setArticleId(Long articleId) 
    {
        this.articleId = articleId;
    }

    public Long getArticleId() 
    {
        return articleId;
    }

    public void setTaskType(String taskType) 
    {
        this.taskType = taskType;
    }

    public String getTaskType() 
    {
        return taskType;
    }

    public void setPriority(Integer priority) 
    {
        this.priority = priority;
    }

    public Integer getPriority() 
    {
        return priority;
    }

    public void setStatus(String status) 
    {
        this.status = status;
    }

    public String getStatus() 
    {
        return status;
    }

    public void setCurrentStep(String currentStep) 
    {
        this.currentStep = currentStep;
    }

    public String getCurrentStep() 
    {
        return currentStep;
    }

    public void setCurrentStepProgress(Integer currentStepProgress) 
    {
        this.currentStepProgress = currentStepProgress;
    }

    public Integer getCurrentStepProgress() 
    {
        return currentStepProgress;
    }

    public void setTotalProgress(Integer totalProgress) 
    {
        this.totalProgress = totalProgress;
    }

    public Integer getTotalProgress() 
    {
        return totalProgress;
    }

    public void setRetryCount(Integer retryCount) 
    {
        this.retryCount = retryCount;
    }

    public Integer getRetryCount() 
    {
        return retryCount;
    }

    public void setMaxRetry(Integer maxRetry) 
    {
        this.maxRetry = maxRetry;
    }

    public Integer getMaxRetry() 
    {
        return maxRetry;
    }

    public void setErrorMessage(String errorMessage) 
    {
        this.errorMessage = errorMessage;
    }

    public String getErrorMessage() 
    {
        return errorMessage;
    }

    public void setWorkerThread(String workerThread) 
    {
        this.workerThread = workerThread;
    }

    public String getWorkerThread() 
    {
        return workerThread;
    }

    public void setStartedAt(Date startedAt) 
    {
        this.startedAt = startedAt;
    }

    public Date getStartedAt() 
    {
        return startedAt;
    }

    public void setCompletedAt(Date completedAt) 
    {
        this.completedAt = completedAt;
    }

    public Date getCompletedAt() 
    {
        return completedAt;
    }

    public void setEstimatedTime(Integer estimatedTime) 
    {
        this.estimatedTime = estimatedTime;
    }

    public Integer getEstimatedTime() 
    {
        return estimatedTime;
    }

    public void setConfig(String config) 
    {
        this.config = config;
    }

    public String getConfig() 
    {
        return config;
    }

    public void setIsCleaned(Boolean isCleaned) 
    {
        this.isCleaned = isCleaned;
    }

    public Boolean getIsCleaned() 
    {
        return isCleaned;
    }

    public void setCleanedAt(Date cleanedAt) 
    {
        this.cleanedAt = cleanedAt;
    }

    public Date getCleanedAt() 
    {
        return cleanedAt;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("taskId", getTaskId())
            .append("articleId", getArticleId())
            .append("taskType", getTaskType())
            .append("priority", getPriority())
            .append("status", getStatus())
            .append("currentStep", getCurrentStep())
            .append("currentStepProgress", getCurrentStepProgress())
            .append("totalProgress", getTotalProgress())
            .append("retryCount", getRetryCount())
            .append("maxRetry", getMaxRetry())
            .append("errorMessage", getErrorMessage())
            .append("workerThread", getWorkerThread())
            .append("startedAt", getStartedAt())
            .append("completedAt", getCompletedAt())
            .append("estimatedTime", getEstimatedTime())
            .append("config", getConfig())
            .append("isCleaned", getIsCleaned())
            .append("cleanedAt", getCleanedAt())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .toString();
    }
}

